package day07;

import java.util.Scanner;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/2/20
 **/
public class CalAirPrice {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入价格");
        double price = scanner.nextDouble();
        System.out.println("请输入月份");
        int month = scanner.nextInt();
        System.out.println("请选择舱位:1头等舱;2商务舱;3经济舱");
        int type = scanner.nextInt();
        double finalPrice = calAirPrice(price, month, type);
        if (finalPrice != -1) {
            System.out.println(finalPrice);
        }
    }

    public static double calAirPrice(double price, int month, int type) {

        double finalPrice = 0.0;
        if (month < 1 || month > 12) {
            System.out.println("月份输入错误");
            return -1;
        }
        if (type < 1 || type > 3) {
            System.out.println("舱位输入错误");
            return -1;
        }
        if (price < 0) {
            System.out.println("价格输入错误");
            return -1;
        }
        if (month >= 4 && month <= 10) {
            switch (type) {
                case 1:
                    finalPrice = price * 0.9;
                    break;
                case 2:
                    finalPrice = price * 0.85;
                    break;
                case 3:
                    finalPrice = price * 0.8;
                    break;
            }
        } else {
            switch (type) {
                case 1:
                    finalPrice = price * 0.7;
                    break;
                case 2:
                    finalPrice = price * 0.65;
                    break;
                case 3:
                    finalPrice = price * 0.6;
                    break;
            }
        }


        return finalPrice;
    }

}